package com.gigmissions.client;

import java.util.Date;
import com.extjs.gxt.ui.client.widget.ContentPanel;

import com.gigmissions.client.model.Venue;
import com.google.gwt.user.client.ui.Label;

public class GigDetailsPanel extends ContentPanel {

	public final static long WEEK_MILLISECONDS = 604800000L;
	private Venue venue;
	private long timeMillies;
	
	public GigDetailsPanel(Venue venue, long timeMillies) {
		
		this.venue = venue;
		this.timeMillies = timeMillies;
		constructUI();
		
	}	
	
	public GigDetailsPanel() {
		
		 this.timeMillies = System.currentTimeMillis();
		 constructUI();
		
	}	
	
	protected void constructUI(){
		
		//add the time bounds
		final long currentTimeMilli = timeMillies;
		final long startTime = currentTimeMilli - WEEK_MILLISECONDS;
		final long endTime = currentTimeMilli + WEEK_MILLISECONDS;
		
		Date date = new Date(currentTimeMilli);
		Date startDate = new Date(startTime);
	    Date endDate = new Date(endTime);
	    
		String sDate = date.toString();
		String sDateStart = startDate.toString();
		String sDateEnd = endDate.toString();
		
		Label lCurrentTime = new Label(sDate);
		Label lStartTime = new Label(sDateStart);
		Label lEndTime = new Label(sDateEnd);
		Label thisWeek = new Label("<- Select a venue to add a gig.");
	    add(lCurrentTime);
	    add(thisWeek);
	    	    
	  
	}
	
}
